# Generated by Django 4.2.6 on 2023-10-19 08:04

import catalog.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Category",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "is_published",
                    models.BooleanField(
                        default=True,
                        help_text="Опубликовано",
                        verbose_name="опубликовано",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Название",
                        max_length=150,
                        unique=True,
                        verbose_name="название",
                    ),
                ),
                (
                    "slug",
                    models.CharField(
                        help_text="Слаг",
                        max_length=200,
                        unique=True,
                        validators=[catalog.validators.chars_validator],
                        verbose_name="слаг",
                    ),
                ),
                (
                    "weight",
                    models.IntegerField(
                        default=100,
                        help_text="Вес",
                        validators=[
                            catalog.validators.RangeValidator(1, 32767)
                        ],
                        verbose_name="вес",
                    ),
                ),
                (
                    "normalized_name",
                    models.CharField(
                        help_text="Уникальное имя", max_length=200, unique=True
                    ),
                ),
            ],
            options={
                "verbose_name": "категория",
                "verbose_name_plural": "категории",
            },
        ),
        migrations.CreateModel(
            name="Tag",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "is_published",
                    models.BooleanField(
                        default=True,
                        help_text="Опубликовано",
                        verbose_name="опубликовано",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Название",
                        max_length=150,
                        unique=True,
                        verbose_name="название",
                    ),
                ),
                (
                    "slug",
                    models.CharField(
                        help_text="Слаг",
                        max_length=200,
                        unique=True,
                        validators=[catalog.validators.chars_validator],
                        verbose_name="слаг",
                    ),
                ),
                (
                    "normalized_name",
                    models.CharField(
                        help_text="Уникальное имя", max_length=200, unique=True
                    ),
                ),
            ],
            options={
                "verbose_name": "тег",
                "verbose_name_plural": "теги",
            },
        ),
        migrations.CreateModel(
            name="Item",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "is_published",
                    models.BooleanField(
                        default=True,
                        help_text="Опубликовано",
                        verbose_name="опубликовано",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Название",
                        max_length=150,
                        unique=True,
                        verbose_name="название",
                    ),
                ),
                (
                    "text",
                    models.TextField(
                        help_text="Текст",
                        validators=[
                            catalog.validators.MustContainValidator(
                                "превосходно", "роскошно"
                            )
                        ],
                        verbose_name="текст",
                    ),
                ),
                (
                    "category",
                    models.ForeignKey(
                        help_text="Категория",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="catalog.category",
                        verbose_name="категория",
                    ),
                ),
                (
                    "tags",
                    models.ManyToManyField(
                        help_text="Теги", to="catalog.tag", verbose_name="теги"
                    ),
                ),
            ],
            options={
                "verbose_name": "товар",
                "verbose_name_plural": "товары",
            },
        ),
    ]
